<%@ page language="java" import="java.util.*"  import="com.gxuwz.medical.domain.chronicdis.*" import="com.gxuwz.medical.dao.*"  import="com.gxuwz.medical.domain.baoxiao.*" import="com.gxuwz.medical.domain.person.*" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="/medical/css/pintuer.css">
<link rel="stylesheet" href="/medical/css/admin.css">
<script src="/medical/js/jquery-1.4.4.min.js"></script>
<script src="/medical/js/pintuer.js"></script>
<script src="/medical/My97DatePicker/WdatePicker.js"></script>
<script src="/medical/third/Lodop6/LodopFuncs.js"></script>
<script>
var LODOP;
function calcu(){
	var idcard = document.getElementById("idcard").value;
	var curemoney = document.getElementById("curemoney").value;
	var htmlobj=$.ajax({url:"/medical/system/BaoxiaoServlet?method=calcu&idcard="+idcard+"&curemoney="+curemoney,async:false});
    var bxobj = JSON.parse(htmlobj.responseText);
	document.getElementById("premoney").value=bxobj.premoney;
	document.getElementById("totalmoney").value=bxobj.totalmoney;
	document.getElementById("relmoney").value=bxobj.relmoney;
    console.log(bxobj);
    return false;
}
function print(){
	createPage();
	LODOP.SET_SHOW_MODE("PREVIEW_IN_BROWSE",true);
	LODOP.SET_SHOW_MODE("BKIMG_IN_PREVIEW",1);
	LODOP.SET_SHOW_MODE("HIDE_PAPER_BOARD ",true);
	LODOP.SET_SHOW_MODE("NP_NO_RESULT",true)
	//LODOP.PREVIEW();
	LODOP.PRINT();
}
function createPage(){
		LODOP=getLodop();  
		LODOP.PRINT_INIT("报销回执单");
		LODOP.SET_PRINT_PAGESIZE(1,"120mm","60mm","");
		LODOP.SET_PRINT_STYLE("FontSize",16);
		LODOP.SET_PRINT_STYLE("Bold",1);
		LODOP.ADD_PRINT_TEXT("10mm","45mm",120,0,"报销回执单");
		LODOP.SET_PRINT_STYLE("FontSize",10);
		LODOP.SET_PRINT_STYLE("Bold",0);
		LODOP.ADD_PRINT_TEXT("20mm","0mm","55mm","0mm","个人信息");
		LODOP.ADD_PRINT_LINE("24mm","0mm","24mm","120mm",2,1);
		LODOP.ADD_PRINT_TEXT("25mm","0mm","55mm","0mm","农合证号:"+document.getElementById("ybcardno").value);
		LODOP.ADD_PRINT_TEXT("30mm","0mm","55mm","0mm","身份证号:"+document.getElementById("idcard").value);
		LODOP.ADD_PRINT_TEXT("30mm","60mm","55mm","0mm","姓名:"+document.getElementById("fullname").value);

		LODOP.ADD_PRINT_TEXT("35mm","0mm","55mm","0mm","报销信息");
		LODOP.ADD_PRINT_LINE("39mm","0mm","39mm","120mm",2,1);
		LODOP.ADD_PRINT_TEXT("40mm","0mm","55mm","0mm","治疗发票号:"+document.getElementById("cureno").value);
		LODOP.ADD_PRINT_TEXT("40mm","60mm","55mm","0mm","治疗时间:"+document.getElementById("curetime").value);
		LODOP.ADD_PRINT_TEXT("45mm","0mm","55mm","0mm","慢性病名称:"+document.getElementById("illname").value);
		LODOP.ADD_PRINT_TEXT("45mm","60mm","55mm","0mm","治疗金额:"+document.getElementById("curemoney").value+"元");
		LODOP.ADD_PRINT_TEXT("50mm","0mm","55mm","0mm","预计报销金额:"+document.getElementById("premoney").value+"元");
		LODOP.ADD_PRINT_TEXT("50mm","40mm","55mm","0mm","累计已报销金额:"+document.getElementById("totalmoney").value+"元");
		LODOP.ADD_PRINT_TEXT("50mm","80mm","55mm","0mm","实际报销金额:"+document.getElementById("relmoney").value+"元");
		
}

function print_sure(){
 	print();
	var form = document.getElementById("addform");
	form.submit();
}
function sure(){
	var form = document.getElementById("addform");
	form.submit();
}

</script>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String idcard=request.getParameter("idcard");
Person person= new PersonDao().queryByIdcard(idcard);
Chronicdis chronicdis = new Chronicdis();
List chronicdisList = chronicdis.queryAll();
%>
</head>
<body>
<!-- <button onclick="print()">打印预览</button> -->
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加慢性病</strong></div>
  <div class="body-content">
  
    <form id="addform" method="post" class="form-x" action="<%=path %>/system/BaoxiaoServlet?method=add">  
		
	  <div class="form-group">
        <div class="label">
          <label>农合证号：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="<%=person.getYbcardno() %>" id="ybcardno" name="ybcardno" data-validate="required:请输入医保卡号" readonly />
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>身份证号：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="<%=person.getIdcard() %>" id="idcard" name="idcard" data-validate="required:请输入身份证号" readonly />
	    </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>姓名：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="<%=person.getFullname() %>" id="fullname" name="fullname" data-validate="required:请输入姓名" readonly />
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>报销慢性病：</label>
        </div>
        <div class="field">
          <select name="illname" id="illname" required>
         	<%
         	if(chronicdisList!=null)
         		for(int i=0;i<chronicdisList.size();i++){
         			chronicdis = (Chronicdis)chronicdisList.get(i);
         	 %>
         	 		<option value="<%=chronicdis.getIllname()%>"><%=chronicdis.getIllname()%></option>
         	 <%}%>
        </select>
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>医疗医院发票号：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="cureno" name="cureno" data-validate="required:请输入医疗医院发票号"  />
	    </div>
      </div>
      


	<div class="form-group">
        <div class="label">
          <label>医疗时间：</label>
        </div>
        <div class="field">
          <input  type="text" class="input w50" id="curetime" name="curetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
	    </div>
      </div>
      
            
        <div class="form-group">
        <div class="label">
          <label>医疗金额：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="curemoney" name="curemoney" data-validate="required:请输入医疗金额"  />
          <button onclick="return calcu();">计算报销金额</button>
	    </div>
      </div>
      
      	<div class="form-group">
        <div class="label">
          <label>预计报销金额：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="premoney" name="premoney" data-validate="required:请点击计算按钮" readonly />
	    </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label>累计报销金额：</label>
        </div>
        <div class="field">
           <input type="text" class="input w50" id="totalmoney" name="totalmoney" data-validate="required:请点击计算按钮" readonly  />
	    </div>
      </div>
      
      	<div class="form-group">
        <div class="label">
          <label>实际报销金额：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="relmoney" name="relmoney" data-validate="required:请点击计算按钮" readonly />
	    </div>
      </div>
      
    </form>
  </div>
</div>
    <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
        <button class="button bg-main icon-check-square-o" type="button" onclick="print_sure();"> 打印，并提交</button>
        <button class="button bg-main icon-check-square-o" type="button" onclick="sure();"> 不打印,直接提交</button>
        </div>
      </div>
</body></html>